package com.weight.common.generate.temple;

import java.util.List;
import java.util.Map;

import com.weight.common.generate.base.ResourceFile;


/**
* 
*  
*/
public class I18nResourceFile extends ResourceFile {
	private static final String FILE_NAME = ".properties";
	
//	protected String fileDir;// 文件路径
//	protected String fileName;//文件名
//	protected String resource;//文件內容
	
	public I18nResourceFile(String filePath,String fileName,String model,List<String> fieldENList,List<String> fieldCNList,String tableCnName) {
		
		super(filePath,new StringBuilder(fileName).append(FILE_NAME).toString());
		StringBuilder  resourceFile =new StringBuilder();
		
		if(!fileName.equals("messages_en_US")) {//messages_en_US/messages_zh_CN/messages
			resourceFile.append("\n");
			resourceFile.append("#").append(tableCnName).append("CN\n");
			for(int i=0;i<fieldENList.size();i++) {
				resourceFile.append(model).append(".").append(fieldENList.get(i)).append(" = ").append(fieldCNList.get(i)).append("\n");
			}
			resourceFile.append("\n");
		}else {
			resourceFile.append("#").append(tableCnName).append("EN\n");
			for(int i=0;i<fieldENList.size();i++) {
				resourceFile.append(model).append(".").append(fieldENList.get(i)).append(" = ").append(fieldENList.get(i)).append("\n");
			}
			resourceFile.append("\n");
		}
		
		String resource = resourceFile.toString();
		init(resource);
	}
}
